'adb shell dumpsys window | findstr mCurrentFocus'
# 截图
'adb shell screencap -p /sdcard/mylinux/mydebian/emobile7/screen.png'
# 获取界面元素
'adb shell uiautomator dump --compressed -p /sdcard/mylinux/mydebian/emobile7/window_dump.xml'
# 拉取文件到电脑
'adb pull /sdcard/mylinux/mydebian/emobile7/window_dump.xml ./upload'
'adb shell am start -n com.weaver.emobile7/weaver.fw.com.WelcomeActivity'
'adb shell am start -n com.weaver.emobile7/com.weaver.platform.WebViewActivity'

import subprocess
import time
import datetime
import sys
import socket
import schedule
from my_email import my_email
from xmlparse import *
import configparser

ENCODE = "utf8"

def shell_run(str):
    cmd1 = subprocess.Popen(
        str,
        shell=True,
        stdout=subprocess.PIPE,
        stderr=subprocess.STDOUT,
        encoding=ENCODE,
    )
    re1, re2 = cmd1.communicate()
    if cmd1.returncode != 0:
        print(re2)
        # email1.send_email("程序出错,已退出任务:\n" + re2, "打卡结果")
        exit()
    print(re1)
    print(1)
    print(re2)
    time.sleep(0.5)

shell_run('adb shell am start -n com.hihonor.photos/com.huawei.gallery.app.GalleryMain')
